package com.cjxt.ams.domain;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.cjxt.ams.groups.UserGroup;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.ToString;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * @author JK_a
 * @version V1.0
 * @Description:
 * @className: User
 * @date 2021/11/19 15:50
 * @company:华勤技术股份有限公司
 * @copyright: Copyright (c) 2021
 */

@Data
@ToString
@TableName("sys_user")
public class User implements Serializable {


    @TableId(value = "id")
    private Integer userId;

    @TableId
    private String username;

    @TableField(value = "useraccount")
    private String userAccount;

    @NotBlank(message = "用户密码不能为空", groups = {UserGroup.AddFirstGroup.class,UserGroup.UpFirstGroup.class})//非空验证
    @Size(min = 6, max = 20, message = "用户口令应该是6到20个字符!", groups = {UserGroup.AddSecondGroup.class,UserGroup.UpSecondGroup.class})
    private String password;

    private String birth;

    @TableField(value = "sex")
    private String sex;

    private String salt;

    private String email;

    @NotBlank(message = "用户手机号不能为空", groups = {UserGroup.AddFirstGroup.class,UserGroup.UpFirstGroup.class})//非空验证
    private String mobile;

    private String address;

    @TableField(value ="status")
    private String status;

    @TableField(value = "dept_id")
    private Integer deptId;

    @TableField(exist = false)
    private String name;

    @TableField(value = "lock_flag")
    private Integer lockFlag;

    @TableField(value = "lock_time")
    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
    private String lockTime;

    @TableField(value = "create_time",fill = FieldFill.INSERT)
    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    @TableField(value = "update_time",fill = FieldFill.UPDATE)
    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    @TableField(value = "create_by")
    private String createBy;

    @TableField(value = "update_by")
    private String updateBy;

    @TableField(exist = false)
    private Integer roleId;

    @TableField(exist = false)
    private String roleName;

    @TableField(exist = false)
    private Integer page;

    @TableField(exist = false)
    private Integer limit;
}
